"""
19_deployment.py - FastAPI Deployment
Run: python src/19_deployment.py
See the PDF book for detailed explanation and concepts.
"""
from typing import TypedDict, Annotated
from operator import add
from langgraph.graph import StateGraph, START, END

class DemoState(TypedDict):
    input: str
    output: str
    messages: Annotated[list, add]

def process_step(state: DemoState) -> dict:
    return {
        "output": f"[FastAPI Deployment] Processed: {state['input']}",
        "messages": ["Step completed successfully"]
    }

graph = StateGraph(DemoState)
graph.add_node("process", process_step)
graph.add_edge(START, "process")
graph.add_edge("process", END)
app = graph.compile()

if __name__ == "__main__":
    print("=" * 60)
    print("19: FastAPI Deployment")
    print("=" * 60)
    result = app.invoke({"input": "test data"})
    print(f"\n  Output: {result['output']}")
    print(f"\n  See LangGraph_Mastery_Complete_Book.pdf for full implementation!")
    print(f"\n{'=' * 60}")
    print("Complete!")
